package com.hx.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //重定项
        /**
         *     等同于
         *     @GetMapping("/")
         *     @ResponseStatus(code = HttpStatus.MOVED_PERMANENTLY)
         *     public String index() {
         *         return "redirect:/login.html";
         *     }
         */
        registry.addRedirectViewController("/", "/index.html");
        registry.addViewController("/index.html").setViewName("/index");
        registry.addViewController("/xljd.html").setViewName("/xljd");
        registry.addViewController("/zbqc.html").setViewName("/zbqc");
    }
}